/*
 * @Descripttion: 
 * @version: 
 * @Author: cyj
 * @Date: 2022-12-24 13:06:50
 */
//格式化歌曲时长插件
function formatDurations(time) {
    time = parseInt(time)
    if (time > 10000) {
        //转成秒 向下取整
        time = Math.floor(time / 1000)
    } else {
        time = Math.floor(time)
    }
    let m = Math.floor(time / 60)
    let s = Math.floor(time % 60)
    m = m < 10 ? '0' + m : m
    s = s < 10 ? '0' + s : s
    return m + ':' + s
}

export default {
    install(app) {
        app.config.globalProperties.$formatDuration = {
            formatDurations
        }
    }
}